#ifndef LEVEL_H
#define LEVEL_H

#include <ClanLib/core.h>
#include "tileset.h"
#include "viewport.h"

class Level
{
public:
	// draw level to a particular viewport
	void draw(Viewport &viewport);
	int get_tile_id(CL_Pointf &pos);
	int get_tile_id(int &x, int &y);
	int get_tile_above(int &tile);
	int get_tile_below(int &tile);
	int get_tile_leftof(int &tile);
	int get_tile_rightof(int &tile);
	CL_Rect get_tile_area(int &tile);
	bool get_tile_solid(int &tile);
	char get_tile_adjacent(int &tile);
	
	int get_smallest_tiledim();
	int get_largest_tiledim();

	char*& get_level_data();

	Level();
	Level(const std::string &resource_id, CL_ResourceManager *manager);
	~Level();

private:
	int height, width;
	char* levelData;
	Tileset tileset;
};

class LevelResourceData : public CL_ResourceData
{
public:
	int width;
	int height;
	char* levelData;

	virtual void on_load();

	LevelResourceData(CL_Resource &);
	~LevelResourceData();
};

#endif